package com.rpc.demo.server;

import com.rpc.demo.interfaces.RmiTestInterface;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

public class RmiTestInterfaceImpl implements RmiTestInterface {
	@Override
	public String getTest() throws RemoteException {
		return "Hello honey";
	}

	public static void main(String[] args) throws RemoteException {
		RmiTestInterfaceImpl rmiTestInterface = new RmiTestInterfaceImpl();
		RmiTestInterface remote = (RmiTestInterface) UnicastRemoteObject.exportObject(rmiTestInterface, 8080);
		Registry registry = LocateRegistry.createRegistry(2181);
		registry.rebind("mytest",remote);
		System.out.println("server started !");
	}
}
